<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wwwApp: workshop.php File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">wwwApp
   </div>
   <div id="projectbrief">A web app for workshop organizing, recruitment and qualification</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">workshop.php File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><a href="workshop_8php_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa02cf384e084e2082688ac6f0fa9b576"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#aa02cf384e084e2082688ac6f0fa9b576">addWarsztatyMenuBox</a> ()</td></tr>
<tr class="memitem:adbee1dd1cb134665df5762397165a698"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#adbee1dd1cb134665df5762397165a698">actionListPublicWorkshops</a> ()</td></tr>
<tr class="memitem:aa0a23a469eaf27d4e25fcd9899232005"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#aa0a23a469eaf27d4e25fcd9899232005">actionListOwnWorkshops</a> ()</td></tr>
<tr class="memitem:ac3693909fdfeb9db13ae3a9bb96f5c23"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#ac3693909fdfeb9db13ae3a9bb96f5c23">actionListAllWorkshops</a> ()</td></tr>
<tr class="memitem:a6a380b691dafabf6af1a71981468f083"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops</a> ($which, $where, $columns)</td></tr>
<tr class="memitem:a02e8f38b818a3b8abd93a56b25d0ede6"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a> ($wid)</td></tr>
<tr class="memitem:a1321a650f322d9871877a1228d324c5f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a1321a650f322d9871877a1228d324c5f">actionShowWorkshop</a> ($wid=null)</td></tr>
<tr class="memitem:a7479c454e1290d452aad78ca5d52fef9"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a7479c454e1290d452aad78ca5d52fef9">actionShowWorkshopTasks</a> ($wid)</td></tr>
<tr class="memitem:a63ff3f7f5188439e639edd7021f90e70"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a63ff3f7f5188439e639edd7021f90e70">actionCreateWorkshop</a> ()</td></tr>
<tr class="memitem:a086c665030f2f28ca42fe178f9832b0f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a086c665030f2f28ca42fe178f9832b0f">actionEditWorkshop</a> ($wid)</td></tr>
<tr class="memitem:a69d3f43278fad0780fdea41c467faccd"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a69d3f43278fad0780fdea41c467faccd">submitEditWorkshopForm</a> (&amp;$wid, $values)</td></tr>
<tr class="memitem:a38fddb96cb8474ef70b6c580aee4397f"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a38fddb96cb8474ef70b6c580aee4397f">actionEditWorkshopLecturers</a> ($wid)</td></tr>
<tr class="memitem:aa7552eb71810bd0d694aada5b3e040da"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#aa7552eb71810bd0d694aada5b3e040da">actionRemoveWorkshopLecturer</a> ($wid, $uid, $confirm=false)</td></tr>
<tr class="memitem:a44e0748dce9adec0e6363a99f50507e0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a44e0748dce9adec0e6363a99f50507e0">actionAddWorkshopLecturer</a> ($wid, $lecturer, $confirm=false)</td></tr>
<tr class="memitem:a538a5114f43f9e0ff781829a2ec568b0"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a538a5114f43f9e0ff781829a2ec568b0">actionSignUpForWorkshop</a> ($wid)</td></tr>
<tr class="memitem:a5a0d9cba96e5c17779acedf8d471605a"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a5a0d9cba96e5c17779acedf8d471605a">actionResignFromWorkshop</a> ($wid)</td></tr>
<tr class="memitem:ae8c3b8a730d8fb94ef2ca3af1e8582a4"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#ae8c3b8a730d8fb94ef2ca3af1e8582a4">subjectOrder</a> ($subjects)</td></tr>
<tr class="memitem:a94f343d568c722874d829e163cf0a361"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="workshop_8php.html#a94f343d568c722874d829e163cf0a361">actionRecountSubjectOrder</a> ()</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="a44e0748dce9adec0e6363a99f50507e0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionAddWorkshopLecturer </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$lecturer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$confirm</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00610">610</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00542">actionEditWorkshopLecturers()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line"></div>
<div class="line">        <span class="comment">/* Convert textual $lecturer to $uid (a long and boring part). */</span></div>
<div class="line">        <span class="keywordflow">if</span> (is_numeric($lecturer))</div>
<div class="line">        {</div>
<div class="line">                $uid = intval($lecturer);</div>
<div class="line">                <span class="keywordflow">if</span> (!isset($DB-&gt;users[$uid]))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;User not found.&#39;</span>));</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                <span class="comment">// Try to match the name.</span></div>
<div class="line">                $uid = $DB-&gt;query(<span class="stringliteral">&#39;SELECT uid FROM table_users WHERE name=$1&#39;</span>, trim($lecturer))-&gt;fetch();</div>
<div class="line">                <span class="keywordflow">if</span> ($uid === null)</div>
<div class="line">                {</div>
<div class="line">                        <span class="comment">// Fuzzy match - find name with least levenshtein distance.</span></div>
<div class="line">                        $names = $DB-&gt;query(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                                SELECT uid, name FROM table_users u</span></div>
<div class="line"><span class="stringliteral">                                WHERE EXISTS (SELECT * FROM table_edition_users eu</span></div>
<div class="line"><span class="stringliteral">                                        WHERE eu.uid=u.uid AND eu.lecturer=1 AND eu.edition=$1)</span></div>
<div class="line"><span class="stringliteral">                                ORDER BY name&#39;</span>, <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>))-&gt;fetch_all();</div>
<div class="line">                        $best = 100000;</div>
<div class="line">                        $bestname = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($names as $name)</div>
<div class="line">                                <span class="keywordflow">if</span> (levenshtein($name[<span class="stringliteral">&#39;name&#39;</span>], $lecturer) &lt; $best)</div>
<div class="line">                                {</div>
<div class="line">                                        $best = levenshtein($name[<span class="stringliteral">&#39;name&#39;</span>], $lecturer);</div>
<div class="line">                                        $uid = $name[<span class="stringliteral">&#39;uid&#39;</span>];</div>
<div class="line">                                        $bestname = $name[<span class="stringliteral">&#39;name&#39;</span>];</div>
<div class="line">                                }</div>
<div class="line">                        $PAGE-&gt;addMessage(sprintf(_(<span class="stringliteral">&#39;Fuzzy-matched user #%d&#39;</span>), $uid) .<span class="stringliteral">&quot; &lt;i&gt;$bestname&lt;/i&gt;&quot;</span>, <span class="stringliteral">&#39;info&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (in_array($uid, $lecturers))</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;The user you selected already is a lecturer here.&#39;</span>), <span class="stringliteral">&#39;userError&#39;</span>);</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;SELECT count(*) FROM table_workshop_users WHERE wid=$1 AND uid=$2&#39;</span>, $wid, $uid);</div>
<div class="line">                <span class="keywordflow">if</span> ($DB-&gt;fetch() &amp;&amp; ($confirm === <span class="keyword">false</span>))</div>
<div class="line">                {</div>
<div class="line">                        $PAGE-&gt;addMessage(</div>
<div class="line">                                _(<span class="stringliteral">&#39;The user already signed up as a participant. Sign him out and add to lecturers?&#39;</span>) .</div>
<div class="line">                                <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>.</div>
<div class="line">                                <span class="stringliteral">&quot;&lt;a href=&#39;addWorkshopLecturer($wid;$uid;1)&#39; class=&#39;button&#39;&gt;&quot;</span>. _(<span class="stringliteral">&#39;yes&#39;</span>) .<span class="stringliteral">&quot;&lt;/a&gt; &quot;</span>.</div>
<div class="line">                                <span class="stringliteral">&quot;&lt;a href=&#39;editWorkshopLecturers($wid)&#39; class=&#39;button&#39;&gt;&quot;</span>. _(<span class="stringliteral">&#39;cancel&#39;</span>). <span class="stringliteral">&quot;&lt;/a&gt;&quot;</span>,</div>
<div class="line">                                <span class="stringliteral">&#39;warning&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                {</div>
<div class="line">                        <span class="keywordflow">if</span> ($confirm !== <span class="keyword">false</span>)</div>
<div class="line">                                $DB-&gt;query(<span class="stringliteral">&#39;DELETE FROM table_workshop_users WHERE wid=$1 AND uid=$2&#39;</span>, $wid, $uid);</div>
<div class="line">                        $DB-&gt;workshop_users[]= array(<span class="stringliteral">&#39;uid&#39;</span>=&gt;$uid, <span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid,</div>
<div class="line">                                <span class="stringliteral">&#39;participant&#39;</span>=&gt;<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;<span class="keywordtype">id</span>);</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Added user to lecturers.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;editWorkshopLecturers&#39;</span>, array($wid));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a63ff3f7f5188439e639edd7021f90e70"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionCreateWorkshop </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00380">380</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        <a class="code" href="workshop_8php.html#a086c665030f2f28ca42fe178f9832b0f">actionEditWorkshop</a>(-1);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a086c665030f2f28ca42fe178f9832b0f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditWorkshop </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00385">385</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00380">actionCreateWorkshop()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $new = ($wid == -1);</div>
<div class="line">        <span class="keywordflow">if</span> ($new &amp;&amp; !<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;createWorkshop&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!$new &amp;&amp; !<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid)))  <span class="keywordflow">throw</span> <span class="keyword">new</span>  <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a5bbc4a39c360e15b0c00714f18d2082b">assertProfileFilled</a>())  <span class="keywordflow">return</span>;</div>
<div class="line"></div>
<div class="line">        $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                NAME        =&gt; TYPE;          tDESCRIPTION;                   VALIDATION;</span></div>
<div class="line"><span class="stringliteral">                title       =&gt; text;          Title;                          length(5 100);</span></div>
<div class="line"><span class="stringliteral">                lecturers   =&gt; readonly;      Lecturers;</span></div>
<div class="line"><span class="stringliteral">                description =&gt; richtextarea;  Description;</span></div>
<div class="line"><span class="stringliteral">                subjects    =&gt; checkboxgroup; Subject;</span></div>
<div class="line"><span class="stringliteral">                type        =&gt; select;        Type;</span></div>
<div class="line"><span class="stringliteral">                duration    =&gt; select;        Duration;                       int;             other;</span></div>
<div class="line"><span class="stringliteral">                link        =&gt; text;          Link to description on wikidot;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!$new)</div>
<div class="line">                $inputs[<span class="stringliteral">&#39;lecturers&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] .= <span class="stringliteral">&quot; &lt;a href=&#39;editWorkshopLecturers($wid)&#39;&gt;[&quot;</span>. _(<span class="stringliteral">&#39;change&#39;</span>) .<span class="stringliteral">&quot;]&lt;/a&gt;&quot;</span>;</div>
<div class="line"></div>
<div class="line">        $inputs[<span class="stringliteral">&#39;description&#39;</span>][<span class="stringliteral">&#39;description&#39;</span>] .= <span class="stringliteral">&#39;&lt;br/&gt;&lt;small&gt;&#39;</span>.</div>
<div class="line">                _(<span class="stringliteral">&#39;Topics addressed, difficulty, scope of material, &#39;</span>.</div>
<div class="line">                  <span class="stringliteral">&#39;what will you do (theoretical problems, coding, experiments, ...). &#39;</span>.</div>
<div class="line">                  <span class="stringliteral">&#39;We encourage possibly detailed descriptions.&#39;</span>)</div>
<div class="line">                .<span class="stringliteral">&#39;&lt;/small&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $inputs[<span class="stringliteral">&#39;subjects&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = <a class="code" href="enum_8php.html#a77f5eebe56acc69d13486423d13cb83d">enumSubject</a>()-&gt;assoc(<span class="stringliteral">&#39;key&#39;</span>, <span class="stringliteral">&#39;description&#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;type&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = <a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>()-&gt;assoc(<span class="stringliteral">&#39;key&#39;</span>,<span class="stringliteral">&#39;description&#39;</span>);</div>
<div class="line"></div>
<div class="line">        $inputs[<span class="stringliteral">&#39;type&#39;</span>][<span class="stringliteral">&#39;properties&#39;</span>] = <span class="stringliteral">&#39;onchange=&quot;$(\&#39;#row_duration\&#39;).toggle(this.selectedIndex==&#39;</span>. <a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>(<span class="stringliteral">&#39;workshop&#39;</span>)-&gt;id .<span class="stringliteral">&#39;);&quot;&#39;</span>;</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;duration&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = array(4=&gt;<span class="stringliteral">&#39;6h (4x1.5h)&#39;</span>, 6=&gt;<span class="stringliteral">&#39;9h (6x1.5h)&#39;</span>);</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;duration&#39;</span>][<span class="stringliteral">&#39;other&#39;</span>] = <span class="stringliteral">&#39;[x1,5h]&lt;span class=&quot;left&quot;&gt;(&#39;</span>.</div>
<div class="line">                _(<span class="stringliteral">&#39;non-standard durations should be&lt;br/&gt; consulted with the organizers.&#39;</span>)</div>
<div class="line">                 .<span class="stringliteral">&#39;)&lt;/span&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">/* It seems more annoying than useful.</span></div>
<div class="line"><span class="comment">        $inputs[&#39;title&#39;][&#39;properties&#39;] = &#39;onchange=&quot;$(\&#39;#link\&#39;)[0].value = \&#39;&#39;.</span></div>
<div class="line"><span class="comment">        &#39;http://warsztatywww.wikidot.com/www9:&#39;.</span></div>
<div class="line"><span class="comment">        &#39;\&#39; +this.value.replace(/[^a-zA-Z0-9]/g,\&#39;_\&#39;);&quot;&#39;;</span></div>
<div class="line"><span class="comment">        */</span></div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;title = $new ? _(<span class="stringliteral">&#39;Propose a new workshop block&#39;</span>) : _(<span class="stringliteral">&#39;Edit a workshop block&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (!$new)</div>
<div class="line">                echo <span class="stringliteral">&quot;&lt;a class=&#39;back&#39; href=&#39;showWorkshop($wid)&#39;&gt;&quot;</span>. _(<span class="stringliteral">&#39;view&#39;</span>) .<span class="stringliteral">&quot;&lt;/a&gt;&quot;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                {</div>
<div class="line">                        <a class="code" href="workshop_8php.html#a69d3f43278fad0780fdea41c467faccd">submitEditWorkshopForm</a>($wid, $values);</div>
<div class="line">                        $new = <span class="keyword">false</span>;</div>
<div class="line">                }</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($new)</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> (time() &gt; $DB-&gt;editions[<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>)]-&gt;<span class="keyword">get</span>(<span class="stringliteral">&#39;proposaldeadline&#39;</span>))</div>
<div class="line">                        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;The deadline for workshop proposal submissions has expired. &#39;</span>.</div>
<div class="line">                                <span class="stringliteral">&#39;Fill the form at your own risk.&#39;</span>), <span class="stringliteral">&#39;warning&#39;</span>);</div>
<div class="line"></div>
<div class="line">                $data = array(</div>
<div class="line">                        <span class="stringliteral">&#39;wid&#39;</span> =&gt; -1,</div>
<div class="line">                        <span class="stringliteral">&#39;title&#39;</span> =&gt; <span class="stringliteral">&#39;&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;description&#39;</span> =&gt; <span class="stringliteral">&#39;&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;status&#39;</span> =&gt; <span class="stringliteral">&#39;new&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;materials&#39;</span> =&gt; <span class="stringliteral">&#39;&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;subjects&#39;</span> =&gt; array(),</div>
<div class="line">                        <span class="stringliteral">&#39;type&#39;</span> =&gt; <span class="stringliteral">&#39;workshop&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;duration&#39;</span> =&gt; 3*2, <span class="comment">//3*2*90min = 9h</span></div>
<div class="line">                        <span class="stringliteral">&#39;duration_min&#39;</span> =&gt; 90,</div>
<div class="line">                        <span class="stringliteral">&#39;link&#39;</span> =&gt; <span class="stringliteral">&#39;http://warsztatywww.wikidot.com/www&#39;</span>. <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>) .<span class="stringliteral">&#39;:tytul-warsztatow&#39;</span></div>
<div class="line">                );</div>
<div class="line">                $lecturers = array($USER[<span class="stringliteral">&#39;uid&#39;</span>]);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $data = $DB-&gt;workshops[$wid]-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">                $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">                $data[<span class="stringliteral">&#39;type&#39;</span>] = <a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>(intval($data[<span class="stringliteral">&#39;type&#39;</span>]))-&gt;key;</div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;SELECT subject FROM table_workshop_subjects WHERE wid=$1&#39;</span>, $wid);</div>
<div class="line">                $data[<span class="stringliteral">&#39;subjects&#39;</span>] = $DB-&gt;fetch_column();</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">foreach</span> ($lecturers as $lecturer)</div>
<div class="line">                $data[<span class="stringliteral">&#39;lecturers&#39;</span>][]= <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($lecturer, <span class="keyword">true</span>);</div>
<div class="line">        $data[<span class="stringliteral">&#39;lecturers&#39;</span>] =  implode(<span class="stringliteral">&#39;, &#39;</span>, $data[<span class="stringliteral">&#39;lecturers&#39;</span>]);</div>
<div class="line">        <span class="keywordflow">if</span> ($new)</div>
<div class="line">                $data[<span class="stringliteral">&#39;lecturers&#39;</span>] .= <span class="stringliteral">&#39; &lt;small class=&quot;right&quot;&gt;&#39;</span>.</div>
<div class="line">                        _(<span class="stringliteral">&#39;You\&#39;ll be able to add more lecturers later, by editing this workshop block.&#39;</span>).</div>
<div class="line">                        <span class="stringliteral">&#39;&lt;/small&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        $form-&gt;values = $data;</div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($data[<span class="stringliteral">&#39;type&#39;</span>] != <span class="stringliteral">&#39;workshop&#39;</span>)</div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;jsOnLoad .= <span class="stringliteral">&#39;$(&quot;#row_duration&quot;).hide();&#39;</span>;</div>
<div class="line">                $PAGE-&gt;jsOnLoad .= <span class="stringliteral">&#39;$(&quot;#row_duration_other&quot;).hide();&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">if</span> (in_array($data[<span class="stringliteral">&#39;duration&#39;</span>], array_keys($inputs[<span class="stringliteral">&#39;duration&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>])))</div>
<div class="line">                $PAGE-&gt;jsOnLoad .= <span class="stringliteral">&#39;$(&quot;#row_duration_other&quot;).hide();&#39;</span>;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a38fddb96cb8474ef70b6c580aee4397f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionEditWorkshopLecturers </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00542">542</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        $inputs = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($lecturers as $lecturer)</div>
<div class="line">                $inputs[<span class="stringliteral">&#39;uid&#39;</span>. $lecturer]= array(</div>
<div class="line">                        <span class="stringliteral">&#39;name&#39;</span> =&gt; <span class="stringliteral">&#39;uid&#39;</span>. $lecturer,</div>
<div class="line">                        <span class="stringliteral">&#39;type&#39;</span> =&gt; <span class="stringliteral">&#39;custom&#39;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;description&#39;</span> =&gt; <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($lecturer, <span class="keyword">true</span>),</div>
<div class="line">                        <span class="stringliteral">&#39;custom&#39;</span>=&gt;<span class="stringliteral">&quot;&lt;a href=&#39;removeWorkshopLecturer($wid;$lecturer)&#39;&gt;[&quot;</span>. _(<span class="stringliteral">&#39;remove&#39;</span>). <span class="stringliteral">&quot;]&lt;/a&gt;&quot;</span></div>
<div class="line">                );</div>
<div class="line"></div>
<div class="line">        $inputs[<span class="stringliteral">&#39;lecturer&#39;</span>]= array(</div>
<div class="line">                <span class="stringliteral">&#39;name&#39;</span>=&gt;<span class="stringliteral">&#39;lecturer&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;type&#39;</span>=&gt;<span class="stringliteral">&#39;text&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;description&#39;</span> =&gt; _(<span class="stringliteral">&#39;Full name or uid&#39;</span>)</div>
<div class="line">        );</div>
<div class="line">        $inputs[<span class="stringliteral">&#39;lecturer&#39;</span>][<span class="stringliteral">&#39;autocomplete&#39;</span>] = $DB-&gt;query(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                SELECT name FROM table_users u</span></div>
<div class="line"><span class="stringliteral">                WHERE EXISTS (SELECT * FROM table_edition_users eu</span></div>
<div class="line"><span class="stringliteral">                        WHERE eu.uid=u.uid AND eu.lecturer=1 AND eu.edition=$1)</span></div>
<div class="line"><span class="stringliteral">                ORDER BY name&#39;</span>, <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>))-&gt;fetch_column();</div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Add/remove lecturers&#39;</span>);</div>
<div class="line">        echo <span class="stringliteral">&quot;&lt;a class=&#39;back&#39; href=&#39;editWorkshop($wid)&#39;&gt;&quot;</span>. _(<span class="stringliteral">&#39;back&#39;</span>) .<span class="stringliteral">&quot;&lt;/a&gt;&quot;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;h3&gt;&#39;</span>. $DB-&gt;workshops($wid)-&gt;get(<span class="stringliteral">&#39;title&#39;</span>) .<span class="stringliteral">&#39;&lt;/h3&gt;&#39;</span>;</div>
<div class="line">        $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">        <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">        {</div>
<div class="line">                $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                        <a class="code" href="workshop_8php.html#a44e0748dce9adec0e6363a99f50507e0">actionAddWorkshopLecturer</a>($wid, $values[<span class="stringliteral">&#39;lecturer&#39;</span>]);</div>
<div class="line">        }</div>
<div class="line">        $form-&gt;submitValue = _(<span class="stringliteral">&#39;Add&#39;</span>);</div>
<div class="line">        echo $form-&gt;getHTML();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ac3693909fdfeb9db13ae3a9bb96f5c23"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionListAllWorkshops </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Lists all workshops, most of all those awaiting acceptation. </p>
<dl class="section see"><dt>See also:</dt><dd><a class="el" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops()</a> </dd></dl>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00072">72</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;listAllWorkshops&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;All workshops&#39;</span>);</div>
<div class="line">        <a class="code" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops</a>(<span class="stringliteral">&#39;All&#39;</span>, <span class="stringliteral">&#39;&#39;</span>,</div>
<div class="line">                array(<span class="stringliteral">&#39;wid&#39;</span>,<span class="stringliteral">&#39;lecturers&#39;</span>,<span class="stringliteral">&#39;title&#39;</span>,<span class="stringliteral">&#39;type&#39;</span>,<span class="stringliteral">&#39;subject&#39;</span>,<span class="stringliteral">&#39;duration&#39;</span>,<span class="stringliteral">&#39;status&#39;</span>,<span class="stringliteral">&#39;participants&#39;</span>));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aa0a23a469eaf27d4e25fcd9899232005"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionListOwnWorkshops </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Lists user's own workshops (those he sent proposals for, or has been added to as a lecturer). </p>
<dl class="section see"><dt>See also:</dt><dd><a class="el" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops()</a> </dd></dl>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00057">57</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;listOwnWorkshops&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Your workshops&#39;</span>);</div>
<div class="line">        $where = <span class="stringliteral">&#39;EXISTS (SELECT wu.uid FROM table_workshop_users wu WHERE wu.uid=&#39;</span>. $USER[<span class="stringliteral">&#39;uid&#39;</span>].<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                AND wu.wid = w.wid AND wu.participant=&#39;</span>. <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;id .<span class="charliteral">&#39;)&#39;</span>;</div>
<div class="line">        <a class="code" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops</a>(<span class="stringliteral">&#39;Own&#39;</span>, $where,</div>
<div class="line">                array(<span class="stringliteral">&#39;wid&#39;</span>,<span class="stringliteral">&#39;lecturers&#39;</span>,<span class="stringliteral">&#39;title&#39;</span>,<span class="stringliteral">&#39;type&#39;</span>,<span class="stringliteral">&#39;subject&#39;</span>,<span class="stringliteral">&#39;duration&#39;</span>,<span class="stringliteral">&#39;status&#39;</span>,<span class="stringliteral">&#39;participants&#39;</span>));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="adbee1dd1cb134665df5762397165a698"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionListPublicWorkshops </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Lists workshops marked as accepted, for the participants to sign up. Displays an information/warning about how much workshops did a user sign up for. </p>
<dl class="section see"><dt>See also:</dt><dd><a class="el" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops()</a> </dd></dl>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00026">26</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>, $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;listPublicWorkshops&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line">        $PAGE-&gt;title = _(<span class="stringliteral">&#39;Workshop list&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a5bbc4a39c360e15b0c00714f18d2082b">assertProfileFilled</a>())  <span class="keywordflow">return</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Inform how many hours of workshops did the user sign up for.</span></div>
<div class="line">        $DB-&gt;query(<span class="stringliteral">&#39;SELECT SUM(w.duration)</span></div>
<div class="line"><span class="stringliteral">                FROM table_workshops w, table_workshop_users wu</span></div>
<div class="line"><span class="stringliteral">                WHERE w.status=$1 AND w.edition=$2 AND wu.wid=w.wid AND wu.uid=$3&#39;</span>,</div>
<div class="line">                <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>(<span class="stringliteral">&#39;accepted&#39;</span>)-&gt;<span class="keywordtype">id</span>, <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>), $USER[<span class="stringliteral">&#39;uid&#39;</span>]);</div>
<div class="line">        $sum = intval($DB-&gt;fetch());</div>
<div class="line">        <span class="keywordflow">if</span> ($sum)</div>
<div class="line">        {</div>
<div class="line">                $msg = sprintf(<a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>(_(<span class="stringliteral">&#39;You signed up for %d x 1,5 hours of workshops.&#39;</span>)), $sum);</div>
<div class="line">                <span class="keywordflow">if</span> ($sum&gt;30)  $msg .= <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>. _(<span class="stringliteral">&#39;Remember that WWW has approximately 36 x 1,5 hours in total.&#39;</span>);</div>
<div class="line">                $PAGE-&gt;addMessage($msg, <span class="stringliteral">&#39;info&#39;</span>);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Public workshops = workshops with type:workshop and status:accepted.</span></div>
<div class="line">        <a class="code" href="workshop_8php.html#a6a380b691dafabf6af1a71981468f083">listWorkshops</a>(<span class="stringliteral">&#39;Public&#39;</span>,</div>
<div class="line">                <span class="stringliteral">&#39;(type=&#39;</span>.  <a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>(<span class="stringliteral">&#39;workshop&#39;</span>)-&gt;<span class="keywordtype">id</span> .<span class="stringliteral">&#39; AND &#39;</span>.</div>
<div class="line">                <span class="stringliteral">&#39;status=&#39;</span>. <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>(<span class="stringliteral">&#39;accepted&#39;</span>)-&gt;<span class="keywordtype">id</span> .<span class="charliteral">&#39;)&#39;</span>,</div>
<div class="line">                array(<span class="stringliteral">&#39;wid&#39;</span>,<span class="stringliteral">&#39;lecturers&#39;</span>,<span class="stringliteral">&#39;title&#39;</span>,<span class="stringliteral">&#39;subject&#39;</span>,<span class="stringliteral">&#39;duration&#39;</span>,<span class="stringliteral">&#39;participants&#39;</span>));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a94f343d568c722874d829e163cf0a361"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionRecountSubjectOrder </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00722">722</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $wids = $DB-&gt;query(<span class="stringliteral">&#39;SELECT wid FROM table_workshops&#39;</span>)-&gt;fetch_column();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($wids as $wid)</div>
<div class="line">        {</div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;SELECT subject FROM table_workshop_subjects WHERE wid=$1&#39;</span>, $wid);</div>
<div class="line">                $order = <a class="code" href="workshop_8php.html#ae8c3b8a730d8fb94ef2ca3af1e8582a4">subjectOrder</a>($DB-&gt;fetch_column());</div>
<div class="line">                $DB-&gt;workshops[$wid]-&gt;update(array(<span class="stringliteral">&#39;subjects_order&#39;</span>=&gt;$order));</div>
<div class="line">        }</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aa7552eb71810bd0d694aada5b3e040da"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionRemoveWorkshopLecturer </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$uid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$confirm</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00583">583</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $uid = intval($uid);</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!in_array($uid, $lecturers))</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;The user is not a lecturer.&#39;</span>), <span class="stringliteral">&#39;userError&#39;</span>);</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (($uid == $USER[<span class="stringliteral">&#39;uid&#39;</span>]) &amp;&amp; !$confirm)</div>
<div class="line">        {</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Are you sure you want to remove yourself from lecturers?&#39;</span>) .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>.</div>
<div class="line">                        <span class="stringliteral">&quot;&lt;a href=&#39;removeWorkshopLecturer($wid;$uid;1)&#39; class=&#39;button&#39;&gt;&quot;</span>. _(<span class="stringliteral">&#39;yes&#39;</span>). <span class="stringliteral">&quot;&lt;/a&gt; &quot;</span>.</div>
<div class="line">                        <span class="stringliteral">&quot;&lt;a href=&#39;editWorkshopLecturers($wid)&#39; class=&#39;button&#39;&gt;&quot;</span>. _(<span class="stringliteral">&#39;cancel&#39;</span>). <span class="stringliteral">&quot;&lt;/a&gt;&quot;</span>,</div>
<div class="line">                        <span class="stringliteral">&#39;warning&#39;</span>);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;DELETE FROM table_workshop_users WHERE wid=$1 AND uid=$2&#39;</span>, $wid, $uid);</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;The user has been removed from lecturers here.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                <span class="keywordflow">if</span> ($uid == $USER[<span class="stringliteral">&#39;uid&#39;</span>])</div>
<div class="line">                        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;listOwnWorkshops&#39;</span>, null, <span class="keyword">true</span>);</div>
<div class="line">        }</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;editWorkshopLecturers&#39;</span>, array($wid));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a5a0d9cba96e5c17779acedf8d471605a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionResignFromWorkshop </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00699">699</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        $dbRow = $DB-&gt;workshop_users[array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid,<span class="stringliteral">&#39;uid&#39;</span>=&gt;$USER[<span class="stringliteral">&#39;uid&#39;</span>])];</div>
<div class="line">        $participant = <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(intval($dbRow-&gt;get(<span class="stringliteral">&#39;participant&#39;</span>)));</div>
<div class="line">        <span class="keywordflow">if</span> (!$participant-&gt;canResign)</div>
<div class="line">                <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;Your can\&#39;t resign from your status: &#39;</span>). $participant-&gt;description);</div>
<div class="line">        $dbRow-&gt;delete();</div>
<div class="line">        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Resigned from workshop block.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;showWorkshop&#39;</span>, array($wid));</div>
<div class="line">        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;workshop participant resign&#39;</span>, $wid);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a1321a650f322d9871877a1228d324c5f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionShowWorkshop </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em> = <code>null</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Displays information about a workshop block (proposal). Displays a simple form for admins to change to workshop block's status </p>
<dl class="params"><dt>Parameters:</dt><dd>
  <table class="params">
    <tr><td class="paramname">$wid</td><td>a wid (workshop id). </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00237">237</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        <span class="keywordflow">if</span> (is_null($wid))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;No workshop id given.&#39;</span>), <span class="stringliteral">&#39;400 Bad Request&#39;</span>); <span class="comment">// Handle deprecated links.</span></div>
<div class="line">        $wid = intval($wid);</div>
<div class="line"></div>
<div class="line">        $data = $DB-&gt;workshops[$wid]-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (!$data)  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;Workshop not found.&#39;</span>), <span class="stringliteral">&#39;404 Not Found&#39;</span>);</div>
<div class="line">        $data[<span class="stringliteral">&#39;title&#39;</span>] = htmlspecialchars($data[<span class="stringliteral">&#39;title&#39;</span>]);</div>
<div class="line">        $data[<span class="stringliteral">&#39;type&#39;</span>] = ucfirst(<a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>(intval($data[<span class="stringliteral">&#39;type&#39;</span>]))-&gt;description);</div>
<div class="line">        $data[<span class="stringliteral">&#39;description&#39;</span>] = <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($data[<span class="stringliteral">&#39;description&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        $participant = $DB-&gt;workshop_users[array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid, <span class="stringliteral">&#39;uid&#39;</span>=&gt;$USER[<span class="stringliteral">&#39;uid&#39;</span>])]-&gt;get(<span class="stringliteral">&#39;participant&#39;</span>);</div>
<div class="line">        $participant = intval($participant);</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Lecturers list.</span></div>
<div class="line">        $data[<span class="stringliteral">&#39;by&#39;</span>] = array();</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        $displayEmail = $participant || <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers);</div>
<div class="line">        <span class="keywordflow">foreach</span> ($lecturers as $lecturer)</div>
<div class="line">                $data[<span class="stringliteral">&#39;by&#39;</span>][]= <a class="code" href="user_2utils_8php.html#a29f037f468ee2716970ae6e7293644e2">getUserBadge</a>($lecturer, $displayEmail);</div>
<div class="line">        $data[<span class="stringliteral">&#39;by&#39;</span>] =  ngettext(<span class="stringliteral">&#39;Lecturer&#39;</span>, <span class="stringliteral">&#39;Lecturers&#39;</span>, count($data[<span class="stringliteral">&#39;by&#39;</span>])) .<span class="stringliteral">&#39;: &#39;</span>. implode(<span class="stringliteral">&#39;, &#39;</span>, $data[<span class="stringliteral">&#39;by&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;showWorkshop&#39;</span>, $lecturers))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (empty($data[<span class="stringliteral">&#39;link&#39;</span>]))</div>
<div class="line">                $data[<span class="stringliteral">&#39;link&#39;</span>] = <span class="stringliteral">&#39;http://warsztatywww.wikidot.com/www&#39;</span>. <a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>).</div>
<div class="line">                        <span class="charliteral">&#39;:&#39;</span>. urlencode($data[<span class="stringliteral">&#39;title&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        <span class="comment">// The subjects.</span></div>
<div class="line">        $subjects = $DB-&gt;query(<span class="stringliteral">&#39;SELECT subject FROM table_workshop_subjects WHERE wid=$1&#39;</span>, $wid);</div>
<div class="line">        $data[<span class="stringliteral">&#39;subjects&#39;</span>] = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($subjects as $subject)</div>
<div class="line">                $data[<span class="stringliteral">&#39;subjects&#39;</span>][]= <a class="code" href="enum_8php.html#a77f5eebe56acc69d13486423d13cb83d">enumSubject</a>($subject[<span class="stringliteral">&#39;subject&#39;</span>])-&gt;description;</div>
<div class="line">        $data[<span class="stringliteral">&#39;subjects&#39;</span>] = implode(<span class="stringliteral">&#39;, &#39;</span>, $data[<span class="stringliteral">&#39;subjects&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Basic info.</span></div>
<div class="line">        $PAGE-&gt;title = $data[<span class="stringliteral">&#39;title&#39;</span>];</div>
<div class="line">        $PAGE-&gt;headerTitle = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">        $template = <span class="keyword">new</span> <a class="code" href="classSimpleTemplate.html">SimpleTemplate</a>($data);</div>
<div class="line">        ?&gt;</div>
<div class="line">                &lt;span <span class="keyword">class</span>=<span class="stringliteral">&#39;left&#39;</span>&gt;%wid%.&amp;nbsp;&lt;/span&gt;&lt;h2&gt;%title% &lt;span <span class="keyword">class</span>=<span class="stringliteral">&#39;tabs&#39;</span>&gt;</div>
<div class="line">                        &lt;a <span class="keyword">class</span>=<span class="stringliteral">&#39;selected&#39;</span>&gt;{{description}}&lt;/a&gt;</div>
<div class="line">                        &lt;a href=<span class="stringliteral">&quot;showWorkshopTasks(%wid%)&quot;</span>&gt;{{signups and tasks}}&lt;/a&gt;</div>
<div class="line">                &lt;/span&gt;&lt;/h2&gt;</div>
<div class="line">                %type%: %subjects%.&lt;br/&gt;</div>
<div class="line">                %by%&lt;br/&gt;</div>
<div class="line">                {{Duration}}: %duration% × 1,5 godz.&lt;br/&gt;</div>
<div class="line">                &lt;a href=<span class="stringliteral">&quot;%link%&quot;</span>&gt;{{see the description on wikidot}}&lt;/a&gt;&lt;br/&gt;</div>
<div class="line">                &lt;br/&gt;</div>
<div class="line">        &lt;?php</div>
<div class="line">        echo $template-&gt;finish(<span class="keyword">true</span>);</div>
<div class="line"></div>
<div class="line">        <span class="comment">// The signup/signout button (same as in showWorkshopTasks).</span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>($participant)-&gt;inArray(array(<span class="stringliteral">&#39;candidate&#39;</span>, <span class="stringliteral">&#39;autoaccepted&#39;</span>)))</div>
<div class="line">                echo <a class="code" href="template_8php.html#a93f1d2b73c6defc9f0af8e7e17b0b47d">getButton</a>(_(<span class="stringliteral">&#39;sign out&#39;</span>), <span class="stringliteral">&quot;resignFromWorkshop($wid)&quot;</span>, <span class="stringliteral">&#39;cart-remove.png&#39;</span>)  .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!$participant &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;signUpForWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                echo <a class="code" href="template_8php.html#a93f1d2b73c6defc9f0af8e7e17b0b47d">getButton</a>(_(<span class="stringliteral">&#39;sign up&#39;</span>), <span class="stringliteral">&quot;signUpForWorkshop($wid)&quot;</span>, <span class="stringliteral">&#39;cart-put.png&#39;</span>) .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// Proposition description.</span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;showWorkshopDetails&#39;</span>, $lecturers)) {</div>
<div class="line">                echo _(<span class="stringliteral">&#39;Proposal&#39;</span>).<span class="stringliteral">&#39;: &lt;div class=&quot;descriptionBox&quot;&gt;&#39;</span>. $data[<span class="stringliteral">&#39;description&#39;</span>] .<span class="stringliteral">&#39;&lt;/div&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="comment">// Workshop block status (e.g. accepted or not).</span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;changeWorkshopStatus&#39;</span>, $lecturers))</div>
<div class="line">        {</div>
<div class="line">                echo _(<span class="stringliteral">&#39;Status:&#39;</span>);</div>
<div class="line">                $inputs = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                        NAME   =&gt; TYPE;   tDESCRIPTION;</span></div>
<div class="line"><span class="stringliteral">                        status =&gt; select; ;</span></div>
<div class="line"><span class="stringliteral">                &#39;</span>);</div>
<div class="line">                $inputs[<span class="stringliteral">&#39;status&#39;</span>][<span class="stringliteral">&#39;options&#39;</span>] = <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>()-&gt;assoc(<span class="stringliteral">&#39;key&#39;</span>, <span class="stringliteral">&#39;decision&#39;</span>);</div>
<div class="line">                $form = <span class="keyword">new</span> <a class="code" href="classForm.html">Form</a>($inputs);</div>
<div class="line">                <span class="keywordflow">if</span> ($form-&gt;submitted())</div>
<div class="line">                {</div>
<div class="line">                        $values = $form-&gt;fetchAndValidateValues();</div>
<div class="line">                        <span class="keywordflow">if</span> ($form-&gt;valid)</div>
<div class="line">                        {</div>
<div class="line">                                $status = <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>($values[<span class="stringliteral">&#39;status&#39;</span>])-&gt;id;</div>
<div class="line">                                $DB-&gt;workshops[$wid]-&gt;update(array(<span class="stringliteral">&#39;status&#39;</span> =&gt; $status));</div>
<div class="line">                                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Changed workshop block status.&#39;</span>));</div>
<div class="line">                                <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;workshop status chg&#39;</span>, $wid);</div>
<div class="line">                        }</div>
<div class="line">                }</div>
<div class="line">                $form-&gt;values[<span class="stringliteral">&#39;status&#39;</span>] = <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>(intval($data[<span class="stringliteral">&#39;status&#39;</span>]))-&gt;key;</div>
<div class="line">                echo $form-&gt;getHTML();</div>
<div class="line">                echo <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;showWorkshopDetails&#39;</span>, $lecturers))</div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;seeWorkshopStatus&#39;</span>))</div>
<div class="line">                        $status = <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>($data[<span class="stringliteral">&#39;status&#39;</span>])-&gt;decision;</div>
<div class="line">                <span class="keywordflow">else</span></div>
<div class="line">                        $status = <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>($data[<span class="stringliteral">&#39;status&#39;</span>])-&gt;status;</div>
<div class="line">                 echo _(<span class="stringliteral">&#39;Status:&#39;</span>) .<span class="stringliteral">&quot; $status&lt;br/&gt;&lt;br/&gt;&quot;</span>;</div>
<div class="line">        }</div>
<div class="line">        <span class="comment">// Edit-workshop button.</span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                echo <a class="code" href="template_8php.html#a93f1d2b73c6defc9f0af8e7e17b0b47d">getButton</a>(_(<span class="stringliteral">&#39;edit&#39;</span>), <span class="stringliteral">&quot;editWorkshop($wid)&quot;</span>, <span class="stringliteral">&#39;brick-edit.png&#39;</span>);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a7479c454e1290d452aad78ca5d52fef9"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionShowWorkshopTasks </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00339">339</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line"></div>
<div class="line">        $data = $DB-&gt;workshops[$wid]-&gt;assoc(<span class="charliteral">&#39;*&#39;</span>);</div>
<div class="line">        $data[<span class="stringliteral">&#39;title&#39;</span>] = htmlspecialchars($data[<span class="stringliteral">&#39;title&#39;</span>]);</div>
<div class="line">        $data[<span class="stringliteral">&#39;type&#39;</span>] = ucfirst(<a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>(intval($data[<span class="stringliteral">&#39;type&#39;</span>]))-&gt;description);</div>
<div class="line">        $data[<span class="stringliteral">&#39;description&#39;</span>] = <a class="code" href="template_8php.html#a4a7e99592a2690b33d53c9bcc8fd3008">parseUserHTML</a>($data[<span class="stringliteral">&#39;description&#39;</span>]);</div>
<div class="line">        $lecturers = <a class="code" href="workshop_8php.html#a02e8f38b818a3b8abd93a56b25d0ede6">getLecturers</a>($wid);</div>
<div class="line">        $participant = $DB-&gt;workshop_users[array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid, <span class="stringliteral">&#39;uid&#39;</span>=&gt;$USER[<span class="stringliteral">&#39;uid&#39;</span>])]-&gt;get(<span class="stringliteral">&#39;participant&#39;</span>);</div>
<div class="line">        $participant = intval($participant);</div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;title = $data[<span class="stringliteral">&#39;title&#39;</span>] .<span class="stringliteral">&#39; - &#39;</span>. _(<span class="stringliteral">&#39;signups and tasks&#39;</span>);</div>
<div class="line">        $PAGE-&gt;headerTitle = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">        $template = <span class="keyword">new</span> <a class="code" href="classSimpleTemplate.html">SimpleTemplate</a>($data);</div>
<div class="line">        ?&gt;</div>
<div class="line">                &lt;span <span class="keyword">class</span>=<span class="stringliteral">&#39;left&#39;</span>&gt;%wid%.&amp;nbsp;&lt;/span&gt;&lt;h2&gt;%title% &lt;span <span class="keyword">class</span>=<span class="stringliteral">&#39;tabs&#39;</span>&gt;</div>
<div class="line">                        &lt;a href=<span class="stringliteral">&#39;showWorkshop(%wid%)&#39;</span>&gt;{{description}}&lt;/a&gt;</div>
<div class="line">                        &lt;a <span class="keyword">class</span>=<span class="stringliteral">&#39;selected&#39;</span>&gt;{{signups and tasks}}&lt;/a&gt;</div>
<div class="line">                &lt;/span&gt;&lt;/h2&gt;</div>
<div class="line">        &lt;?php</div>
<div class="line">        echo $template-&gt;finish(<span class="keyword">true</span>);</div>
<div class="line"></div>
<div class="line">        echo _(<span class="stringliteral">&#39;Your status:&#39;</span>) .<span class="stringliteral">&#39; &lt;i&gt;&#39;</span>. <a class="code" href="user_2utils_8php.html#a7144fa5a413ad5690425b7b720aeedba">genderize</a>(<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>($participant)-&gt;explanation) .<span class="stringliteral">&#39;&lt;/i&gt;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// The signup/signout button (same as in showWorkshop).</span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>($participant)-&gt;inArray(array(<span class="stringliteral">&#39;candidate&#39;</span>, <span class="stringliteral">&#39;autoaccepted&#39;</span>)))</div>
<div class="line">                echo <a class="code" href="template_8php.html#a93f1d2b73c6defc9f0af8e7e17b0b47d">getButton</a>(_(<span class="stringliteral">&#39;sign out&#39;</span>), <span class="stringliteral">&quot;resignFromWorkshop($wid)&quot;</span>, <span class="stringliteral">&#39;cart-remove.png&#39;</span>)  .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!$participant &amp;&amp; <a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;signUpForWorkshop&#39;</span>, $lecturers))</div>
<div class="line">                echo <a class="code" href="template_8php.html#a93f1d2b73c6defc9f0af8e7e17b0b47d">getButton</a>(_(<span class="stringliteral">&#39;sign up&#39;</span>), <span class="stringliteral">&quot;signUpForWorkshop($wid)&quot;</span>, <span class="stringliteral">&#39;cart-put.png&#39;</span>) .<span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line">        echo <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// List of signed-up participants.</span></div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;showWorkshopParticipants&#39;</span>, $lecturers))</div>
<div class="line">                echo <a class="code" href="tasks_8php.html#ae1f5d73a5ddf78d15aa18706f9786b14">buildParticipantList</a>($wid) . <span class="stringliteral">&#39;&lt;br/&gt;&#39;</span>;</div>
<div class="line"></div>
<div class="line">        <span class="comment">// List of qualification tasks.</span></div>
<div class="line">        echo <a class="code" href="tasks_8php.html#a5330df836d593c05befda9913a6acc23">buildTaskList</a>($wid);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a538a5114f43f9e0ff781829a2ec568b0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">actionSignUpForWorkshop </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00674">674</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $wid = intval($wid);</div>
<div class="line">        <span class="keywordflow">if</span> (!<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;signUpForWorkshop&#39;</span>))  <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classPolicyException.html">PolicyException</a>();</div>
<div class="line"></div>
<div class="line">        $participant = <span class="stringliteral">&#39;candidate&#39;</span>;</div>
<div class="line">        <span class="keywordflow">if</span> (<a class="code" href="user_2utils_8php.html#a1e9c8ed2c5ed2def1a367c9ffd04114b">userCan</a>(<span class="stringliteral">&#39;autoQualifyForWorkshop&#39;</span>))  $participant = <span class="stringliteral">&#39;autoaccepted&#39;</span>;</div>
<div class="line">        $participant = <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>($participant)-&gt;id;</div>
<div class="line"></div>
<div class="line">        $dbRow = $DB-&gt;workshop_users[array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid,<span class="stringliteral">&#39;uid&#39;</span>=&gt;$USER[<span class="stringliteral">&#39;uid&#39;</span>])];</div>
<div class="line">        <span class="keywordflow">if</span> (!$dbRow-&gt;count())</div>
<div class="line">                $DB-&gt;workshop_users[] = array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid,<span class="stringliteral">&#39;uid&#39;</span>=&gt;$USER[<span class="stringliteral">&#39;uid&#39;</span>], <span class="stringliteral">&#39;participant&#39;</span>=&gt;$participant);</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                <span class="keywordflow">if</span> ($dbRow-&gt;get(<span class="stringliteral">&#39;participant&#39;</span>) != <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;none&#39;</span>)-&gt;id)</div>
<div class="line">                        <span class="keywordflow">throw</span> <span class="keyword">new</span> <a class="code" href="classKnownException.html">KnownException</a>(_(<span class="stringliteral">&#39;You\&#39;re already signed up for this workshop block.&#39;</span>));</div>
<div class="line">                $dbRow-&gt;update(array(<span class="stringliteral">&#39;participant&#39;</span>=&gt;$participant));</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Signed up for a workshop block.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">        <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;showWorkshop&#39;</span>, array($wid));</div>
<div class="line">        <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;workshop participant signup&#39;</span>, $wid);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="aa02cf384e084e2082688ac6f0fa9b576"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">addWarsztatyMenuBox </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Menu box with workshop-specific actions. </p>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00010">10</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $PAGE-&gt;addMenuBox(<span class="stringliteral">&#39;Warsztaty&#39;</span>, <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                ACTION              =&gt; tTitle;                     ICON;</span></div>
<div class="line"><span class="stringliteral">                listPublicWorkshops =&gt; workshop list;              brick.png;</span></div>
<div class="line"><span class="stringliteral">                listOwnWorkshops    =&gt; your workshops;             brick-green.png;</span></div>
<div class="line"><span class="stringliteral">                createWorkshop      =&gt; propose new workshops;      brick-add.png;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>));</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a02e8f38b818a3b8abd93a56b25d0ede6"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">getLecturers </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$wid</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns array of uids of given workshop's lecturers.. </p>
<dl class="params"><dt>Parameters:</dt><dd>
  <table class="params">
    <tr><td class="paramname">$wid</td><td>a wid (workshop id). </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00224">224</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00610">actionAddWorkshopLecturer()</a>, <a class="el" href="tasks_8php_source.html#l00138">actionDeleteTask()</a>, <a class="el" href="tasks_8php_source.html#l00086">actionEditTask()</a>, <a class="el" href="workshop_8php_source.html#l00385">actionEditWorkshop()</a>, <a class="el" href="workshop_8php_source.html#l00542">actionEditWorkshopLecturers()</a>, <a class="el" href="workshop_8php_source.html#l00583">actionRemoveWorkshopLecturer()</a>, <a class="el" href="workshop_8php_source.html#l00339">actionShowWorkshopTasks()</a>, <a class="el" href="tasks_8php_source.html#l00248">buildParticipantList()</a>, and <a class="el" href="tasks_8php_source.html#l00009">buildTaskList()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>;</div>
<div class="line">        $lecturers = $DB-&gt;query(<span class="stringliteral">&#39;SELECT uid FROM table_workshop_users WHERE participant=$1 AND wid=$2&#39;</span>,</div>
<div class="line">                <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;<span class="keywordtype">id</span>, $wid);</div>
<div class="line">        <span class="keywordflow">return</span> $lecturers-&gt;fetch_column();</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a6a380b691dafabf6af1a71981468f083"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">listWorkshops </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$which</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$where</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$columns</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Lists workshops in a table. (Admins need different information than lecturers, but most of it is the same.) </p>
<dl class="params"><dt>Parameters:</dt><dd>
  <table class="params">
    <tr><td class="paramname">$which</td><td>'Public', 'Own' or 'All' </td></tr>
    <tr><td class="paramname">$where</td><td>a WHERE sql clause limiting the workshops listed. </td></tr>
    <tr><td class="paramname">$columns</td><td>columns to be displayed. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00088">88</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00072">actionListAllWorkshops()</a>, <a class="el" href="workshop_8php_source.html#l00057">actionListOwnWorkshops()</a>, and <a class="el" href="workshop_8php_source.html#l00026">actionListPublicWorkshops()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line"></div>
<div class="line">        $cols = <a class="code" href="utils_8php.html#ae70693a7d9a8484219fe57bdf2d2a46f">parseTable</a>(<span class="stringliteral">&#39;</span></div>
<div class="line"><span class="stringliteral">                COLUMN        =&gt; tTH;             ORDER;</span></div>
<div class="line"><span class="stringliteral">                wid           =&gt; #;               w.wid;</span></div>
<div class="line"><span class="stringliteral">                lecturers     =&gt; lecturers;       lecturers;</span></div>
<div class="line"><span class="stringliteral">                title         =&gt; title;           w.title;</span></div>
<div class="line"><span class="stringliteral">                type          =&gt; type;            w.type;</span></div>
<div class="line"><span class="stringliteral">                subject       =&gt; subjects;        w.subjects_order;</span></div>
<div class="line"><span class="stringliteral">                duration      =&gt; duration [1.5h]; w.duration DESC;</span></div>
<div class="line"><span class="stringliteral">                status        =&gt; status;          w.status;</span></div>
<div class="line"><span class="stringliteral">                participants  =&gt; signups;         count_accepted DESC;</span></div>
<div class="line"><span class="stringliteral">        &#39;</span>);</div>
<div class="line"></div>
<div class="line">        $from = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line">        $whereClauses = array();</div>
<div class="line">        $orderby = array();</div>
<div class="line">        <span class="comment">/* ORDER BY (remember in SESSION, keep stabile, special order when ordering by lecturers) */</span></div>
<div class="line">        $allowed = array();</div>
<div class="line">        <span class="keywordflow">foreach</span> ($cols as $col)  <span class="keywordflow">if</span> ($col[<span class="stringliteral">&#39;order&#39;</span>] != <span class="stringliteral">&#39;lecturers&#39;</span>)  $allowed[]= $col[<span class="stringliteral">&#39;order&#39;</span>];</div>
<div class="line">        <span class="keywordflow">if</span> (!isset($_SESSION[<span class="stringliteral">&#39;workshopOrder&#39;</span>]))  $_SESSION[<span class="stringliteral">&#39;workshopOrder&#39;</span>] = array();</div>
<div class="line">        <span class="keywordflow">if</span> (isset($_GET[<span class="stringliteral">&#39;order&#39;</span>]) &amp;&amp; $_GET[<span class="stringliteral">&#39;order&#39;</span>] ==<span class="stringliteral">&#39;lecturers&#39;</span>)</div>
<div class="line">        {</div>
<div class="line">                $orderby[] = <span class="stringliteral">&#39;u.ordername&#39;</span>;</div>
<div class="line">                $from = <span class="stringliteral">&#39;, table_users u&#39;</span>;</div>
<div class="line">                $whereClauses[] = <span class="stringliteral">&#39;EXISTS (SELECT * FROM table_workshop_users wu</span></div>
<div class="line"><span class="stringliteral">                        WHERE w.wid=wu.wid AND u.uid=wu.uid</span></div>
<div class="line"><span class="stringliteral">                                AND participant=&#39;</span>. <a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;id .<span class="charliteral">&#39;)&#39;</span>;</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;When sorting by lecturers, common workshops are shown repeatedly.&#39;</span>), <span class="stringliteral">&#39;info&#39;</span>);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (isset($_GET[<span class="stringliteral">&#39;order&#39;</span>]))</div>
<div class="line">                $_SESSION[<span class="stringliteral">&#39;workshopOrder&#39;</span>][]= $_GET[<span class="stringliteral">&#39;order&#39;</span>];</div>
<div class="line">        <span class="keywordflow">while</span> (count($_SESSION[<span class="stringliteral">&#39;workshopOrder&#39;</span>]) &gt; 3)</div>
<div class="line">                array_shift($_SESSION[<span class="stringliteral">&#39;workshopOrder&#39;</span>]);</div>
<div class="line"></div>
<div class="line">        $orderClauses = array_reverse($_SESSION[<span class="stringliteral">&#39;workshopOrder&#39;</span>]);</div>
<div class="line">        $orderClauses[]= <span class="stringliteral">&#39;w.title&#39;</span>;</div>
<div class="line">        <span class="keywordflow">foreach</span> ($orderClauses as $o)</div>
<div class="line">                <span class="keywordflow">if</span> (in_array($o, $allowed, <span class="keyword">true</span>) &amp;&amp; !in_array($o, $orderby))</div>
<div class="line">                        $orderby[]= $o;</div>
<div class="line">        $orderby = implode(<span class="charliteral">&#39;,&#39;</span>, $orderby);</div>
<div class="line"></div>
<div class="line">        <span class="comment">/* WHERE (current editions, restriction to subject) */</span></div>
<div class="line">        <span class="keywordflow">if</span> (!empty($where))  $whereClauses[]= $where;</div>
<div class="line">        $whereClauses[]= <span class="stringliteral">&#39;w.edition=&#39;</span>. intval(<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>));</div>
<div class="line">        <span class="keywordflow">if</span> (isset($_GET[<span class="stringliteral">&#39;subject&#39;</span>]) &amp;&amp; <a class="code" href="enum_8php.html#a77f5eebe56acc69d13486423d13cb83d">enumSubject</a>()-&gt;exists($_GET[<span class="stringliteral">&#39;subject&#39;</span>]))</div>
<div class="line">                $whereClauses[]= <span class="stringliteral">&#39;EXISTS (SELECT * FROM table_workshop_subjects ws</span></div>
<div class="line"><span class="stringliteral">                        WHERE ws.wid=w.wid AND ws.subject=\&#39;&#39;</span>. $_GET[<span class="stringliteral">&#39;subject&#39;</span>] .<span class="charliteral">&#39;\&#39;</span>)<span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">        if (!empty($whereClauses))  $where = &#39;</span>WHERE <span class="stringliteral">&#39;. implode(&#39;</span> AND <span class="stringliteral">&#39;, $whereClauses);</span></div>
<div class="line"><span class="stringliteral">        else $where = &#39;</span><span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">        /* SELECT (participant counts by status) */</span></div>
<div class="line"><span class="stringliteral">        $selectParticipants = &#39;</span><span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">        foreach (enumParticipantStatus() as $statusName =&gt; $status)</span></div>
<div class="line"><span class="stringliteral">                $selectParticipants .= &#39;</span>(SELECT COUNT(*) FROM table_workshop_users wu</div>
<div class="line">                        WHERE wu.wid=w.wid AND participant=&#39;. $status-&gt;<span class="keywordtype">id</span> .&#39;) AS count_&#39;. $statusName .&#39;,&#39;;</div>
<div class="line"></div>
<div class="line"></div>
<div class="line">        $workshops = $DB-&gt;query(&#39;</div>
<div class="line">                SELECT w.wid, w.title, w.status, w.type, w.duration, w.link,</div>
<div class="line">                        &#39;. $selectParticipants .&#39;</div>
<div class="line">                        (SELECT participant FROM table_workshop_users wu</div>
<div class="line">                         WHERE wu.wid=w.wid AND wu.uid=$1) AS participant</div>
<div class="line">                FROM table_workshops w&#39;. $from .&#39;</div>
<div class="line">                &#39;. $where .&#39;</div>
<div class="line">                ORDER BY w.edition DESC, &#39;. $orderby, $USER[&#39;uid&#39;]);</div>
<div class="line"></div>
<div class="line">        $PAGE-&gt;headerTitle = &quot;&lt;h2&gt;&lt;a href=&#39;list${which}Workshops<span class="stringliteral">&#39;&gt;&quot;. $PAGE-&gt;title . &quot;&lt;/a&gt;&lt;/h2&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">        echo &quot;&lt;table class=&#39;</span>workshopList<span class="stringliteral">&#39;&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">        echo &quot;&lt;thead&gt;&lt;tr&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">        foreach ($columns as $c)</span></div>
<div class="line"><span class="stringliteral">        {</span></div>
<div class="line"><span class="stringliteral">                $th = $cols[$c][&#39;</span>th<span class="stringliteral">&#39;];</span></div>
<div class="line"><span class="stringliteral">                $order = htmlspecialchars(urlencode($cols[$c][&#39;</span>order<span class="stringliteral">&#39;]), ENT_QUOTES);</span></div>
<div class="line"><span class="stringliteral">                echo &quot;&lt;th&gt;&lt;a href=&#39;</span>list${which}Workshops?order=$order<span class="stringliteral">&#39;&gt;$th&lt;/a&gt;&lt;/th&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">        }</span></div>
<div class="line"><span class="stringliteral">        echo &quot;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">        foreach ($workshops as $row)</span></div>
<div class="line"><span class="stringliteral">        {</span></div>
<div class="line"><span class="stringliteral">                $status = enumBlockStatus(intval($row[&#39;</span>status<span class="stringliteral">&#39;]));</span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>status<span class="stringliteral">&#39;] = userCan(&#39;</span>seeWorkshopStatus<span class="stringliteral">&#39;) ? $status-&gt;decision : $status-&gt;status;</span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>status<span class="stringliteral">&#39;] = str_replace(&#39;</span> <span class="charliteral">&#39;,&#39;</span>&amp;nbsp;<span class="stringliteral">&#39;, $row[&#39;</span>status<span class="stringliteral">&#39;]);</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>lecturers<span class="stringliteral">&#39;] = array();</span></div>
<div class="line"><span class="stringliteral">                foreach (getLecturers($row[&#39;</span>wid<span class="stringliteral">&#39;]) as $lecturer)</span></div>
<div class="line"><span class="stringliteral">                        $row[&#39;</span>lecturers<span class="stringliteral">&#39;][]= getUserBadge($lecturer);</span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>lecturers<span class="stringliteral">&#39;] = implode(&#39;</span>,&lt;br/&gt;<span class="stringliteral">&#39;, $row[&#39;</span>lecturers<span class="stringliteral">&#39;]);</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>type<span class="stringliteral">&#39;] = enumBlockType(intval($row[&#39;</span>type<span class="stringliteral">&#39;]))-&gt;short;</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $subjects = $DB-&gt;query(&#39;</span></div>
<div class="line">                        SELECT subject FROM table_workshop_subjects</div>
<div class="line">                        WHERE wid=$1 ORDER BY subject<span class="stringliteral">&#39;, $row[&#39;</span>wid<span class="stringliteral">&#39;])-&gt;fetch_column();</span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>subject<span class="stringliteral">&#39;] = &#39;</span><span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                foreach ($subjects as $subject)</span></div>
<div class="line"><span class="stringliteral">                {</span></div>
<div class="line"><span class="stringliteral">                        $s = enumSubject($subject);</span></div>
<div class="line"><span class="stringliteral">                        $row[&#39;</span>subject<span class="stringliteral">&#39;] .= getIcon(&#39;</span>subject-<span class="stringliteral">&#39;. $s-&gt;icon .&#39;</span>.png<span class="stringliteral">&#39;, $s-&gt;description,</span></div>
<div class="line"><span class="stringliteral">                         &quot;list${which}Workshops?subject=$subject&quot;);</span></div>
<div class="line"><span class="stringliteral">                }</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>title<span class="stringliteral">&#39;] = &#39;</span>&lt;a href=<span class="stringliteral">&quot;showWorkshop(&#39;. $row[&#39;wid&#39;] .&#39;)&quot;</span>&gt;<span class="stringliteral">&#39;. $row[&#39;</span>title<span class="stringliteral">&#39;] .&#39;</span>&lt;/a&gt;<span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $row[&#39;</span>participants<span class="stringliteral">&#39;] = &#39;</span><span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                if (userCan(&#39;</span>showWorkshopParticipants<span class="stringliteral">&#39;, getLecturers($row[&#39;</span>wid<span class="stringliteral">&#39;])))</span></div>
<div class="line"><span class="stringliteral">                {</span></div>
<div class="line"><span class="stringliteral">                        $tip = &#39;</span><span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                        foreach (enumParticipantStatus() as $statusName =&gt; $status)</span></div>
<div class="line"><span class="stringliteral">                                $tip .= genderize($status-&gt;description, &#39;</span>p<span class="stringliteral">&#39;) .&#39;</span>: <span class="stringliteral">&#39;. $row[&quot;count_$statusName&quot;] .&#39;</span>&lt;br/&gt;<span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                        $row[&#39;</span>participants<span class="stringliteral">&#39;] .= &#39;</span>&lt;a href=<span class="stringliteral">&quot;showWorkshopTasks(&#39;. $row[&#39;wid&#39;] .&#39;)&quot;</span> <span class="stringliteral">&#39;. getTipJS($tip) .&#39;</span>&gt;<span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                        $row[&#39;</span>participants<span class="stringliteral">&#39;] .= ($row[&#39;</span>count_accepted<span class="stringliteral">&#39;] + $row[&#39;</span>count_autoaccepted<span class="stringliteral">&#39;]) .&#39;</span>&lt;/a&gt;<span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                }</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $participant = enumParticipantStatus(intval($row[&#39;</span>participant<span class="stringliteral">&#39;]));</span></div>
<div class="line"><span class="stringliteral">                if (isset($participant-&gt;icon))</span></div>
<div class="line"><span class="stringliteral">                        $row[&#39;</span>participants<span class="stringliteral">&#39;] .= &#39;</span> <span class="stringliteral">&#39;. getIcon($participant-&gt;icon, genderize($participant-&gt;explanation));</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                $class = alternate(&#39;</span>even<span class="stringliteral">&#39;, &#39;</span>odd<span class="stringliteral">&#39;);</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">                echo &quot;&lt;tr class=&#39;</span>$class<span class="stringliteral">&#39;&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">                foreach ($columns as $c)</span></div>
<div class="line"><span class="stringliteral">                        echo &#39;</span>&lt;td&gt;<span class="stringliteral">&#39;. $row[$c] .&#39;</span>&lt;/td&gt;<span class="stringliteral">&#39;;</span></div>
<div class="line"><span class="stringliteral">                echo &quot;&lt;/tr&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral">        }</span></div>
<div class="line"><span class="stringliteral">        echo &quot;&lt;/tbody&gt;&lt;/table&gt;&quot;;</span></div>
<div class="line"><span class="stringliteral"></span></div>
<div class="line"><span class="stringliteral">        if (count($workshops) == 0)</span></div>
<div class="line"><span class="stringliteral">                echo _(&#39;</span>No workshops have been accepted <span class="keywordflow">for</span> <span class="keyword">this</span> edition yet.<span class="stringliteral">&#39;);</span></div>
<div class="line"><span class="stringliteral">}</span></div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="ae8c3b8a730d8fb94ef2ca3af1e8582a4"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">subjectOrder </td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$subjects</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00713">713</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00722">actionRecountSubjectOrder()</a>, and <a class="el" href="workshop_8php_source.html#l00495">submitEditWorkshopForm()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        $r = 0;</div>
<div class="line">        <span class="keywordflow">foreach</span> (<a class="code" href="enum_8php.html#a77f5eebe56acc69d13486423d13cb83d">enumSubject</a>() as $subjectName=&gt;$subject)</div>
<div class="line">                <span class="keywordflow">if</span> (in_array($subjectName, $subjects))</div>
<div class="line">                        $r += $subject-&gt;orderWeight;</div>
<div class="line">        <span class="keywordflow">return</span> $r;</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a class="anchor" id="a69d3f43278fad0780fdea41c467faccd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">submitEditWorkshopForm </td>
          <td>(</td>
          <td class="paramtype">&amp;&#160;</td>
          <td class="paramname"><em>$wid</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>$values</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Definition at line <a class="el" href="workshop_8php_source.html#l00495">495</a> of file <a class="el" href="workshop_8php_source.html">workshop.php</a>.</p>

<p>Referenced by <a class="el" href="workshop_8php_source.html#l00385">actionEditWorkshop()</a>.</p>
<div class="fragment"><div class="line">{</div>
<div class="line">        global $USER, <a class="code" href="common_8php.html#a7dc56dc8b18ad37272b56fa7395bedef">$DB</a>, <a class="code" href="index_8php.html#ae1848ae8dc4014bc7c680e5504a8eef0">$PAGE</a>;</div>
<div class="line">        $new = ($wid==-1);</div>
<div class="line"></div>
<div class="line">        $data = array(</div>
<div class="line">                <span class="stringliteral">&#39;title&#39;</span> =&gt; $values[<span class="stringliteral">&#39;title&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;description&#39;</span> =&gt; $values[<span class="stringliteral">&#39;description&#39;</span>],</div>
<div class="line">                <span class="stringliteral">&#39;type&#39;</span> =&gt; <a class="code" href="enum_8php.html#a11cd73ec04448245e92daedfab9c2bdd">enumBlockType</a>($values[<span class="stringliteral">&#39;type&#39;</span>])-&gt;<span class="keywordtype">id</span>,</div>
<div class="line">                <span class="stringliteral">&#39;duration&#39;</span> =&gt; ($values[<span class="stringliteral">&#39;type&#39;</span>] == <span class="stringliteral">&#39;lightLecture&#39;</span>) ? 1 : intval($values[<span class="stringliteral">&#39;duration&#39;</span>]),</div>
<div class="line">                <span class="stringliteral">&#39;link&#39;</span> =&gt; trim($values[<span class="stringliteral">&#39;link&#39;</span>]),</div>
<div class="line">                <span class="stringliteral">&#39;subjects_order&#39;</span> =&gt; empty($_POST[<span class="stringliteral">&#39;subjects&#39;</span>]) ? 0 : <a class="code" href="workshop_8php.html#ae8c3b8a730d8fb94ef2ca3af1e8582a4">subjectOrder</a>($_POST[<span class="stringliteral">&#39;subjects&#39;</span>])</div>
<div class="line">        );</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (empty($data[<span class="stringliteral">&#39;link&#39;</span>]))  $data[<span class="stringliteral">&#39;link&#39;</span>] = null;</div>
<div class="line">        <span class="keywordflow">else</span> <span class="keywordflow">if</span> (strpos($data[<span class="stringliteral">&#39;link&#39;</span>], <span class="stringliteral">&#39;http://&#39;</span>) !== 0  &amp;&amp;  strpos($data[<span class="stringliteral">&#39;link&#39;</span>], <span class="stringliteral">&#39;https://&#39;</span>) !== 0)</div>
<div class="line">                $data[<span class="stringliteral">&#39;link&#39;</span>] = <span class="stringliteral">&#39;http://&#39;</span>. $data[<span class="stringliteral">&#39;link&#39;</span>];</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> ($new)</div>
<div class="line">        {</div>
<div class="line">                $data = $data + array(</div>
<div class="line">                        <span class="stringliteral">&#39;edition&#39;</span> =&gt; intval(<a class="code" href="utils_8php.html#a86acce3c002ca1af709fd1b04f2f82fa">getOption</a>(<span class="stringliteral">&#39;currentEdition&#39;</span>)),</div>
<div class="line">                        <span class="stringliteral">&#39;status&#39;</span> =&gt; <a class="code" href="enum_8php.html#a5fba087a3870146b12b7b12c9bfc7d11">enumBlockStatus</a>(<span class="stringliteral">&#39;new&#39;</span>)-&gt;<span class="keywordtype">id</span></div>
<div class="line">                );</div>
<div class="line">                $DB-&gt;workshops[] = $data;</div>
<div class="line">                $wid = $DB-&gt;workshops-&gt;lastValue();</div>
<div class="line">                $DB-&gt;workshop_users[]= array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid, <span class="stringliteral">&#39;uid&#39;</span>=&gt;$USER[<span class="stringliteral">&#39;uid&#39;</span>],</div>
<div class="line">                        <span class="stringliteral">&#39;participant&#39;</span>=&gt;<a class="code" href="enum_8php.html#af4fcf7a20cf66ed8f77cae36bc444b83">enumParticipantStatus</a>(<span class="stringliteral">&#39;lecturer&#39;</span>)-&gt;<span class="keywordtype">id</span>);</div>
<div class="line">                <span class="keywordflow">if</span> (!empty($_POST[<span class="stringliteral">&#39;subjects&#39;</span>]))</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($_POST[<span class="stringliteral">&#39;subjects&#39;</span>] as $d)</div>
<div class="line">                                $DB-&gt;workshop_subjects[]= array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid, <span class="stringliteral">&#39;subject&#39;</span>=&gt;$d);</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Your proposal has been submitted.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;workshop new&#39;</span>, $wid);</div>
<div class="line">                <a class="code" href="index_8php.html#a6e8525da6dad002542958c13132118e4">callAction</a>(<span class="stringliteral">&#39;editWorkshop&#39;</span>, array($wid), <span class="keyword">true</span>);</div>
<div class="line">        }</div>
<div class="line">        <span class="keywordflow">else</span></div>
<div class="line">        {</div>
<div class="line">                $DB-&gt;workshops[$wid]-&gt;update($data);</div>
<div class="line">                $DB-&gt;query(<span class="stringliteral">&#39;DELETE FROM table_workshop_subjects WHERE wid=$1&#39;</span>, $wid);</div>
<div class="line">                <span class="keywordflow">if</span> (!empty($_POST[<span class="stringliteral">&#39;subjects&#39;</span>]))</div>
<div class="line">                        <span class="keywordflow">foreach</span> ($_POST[<span class="stringliteral">&#39;subjects&#39;</span>] as $d)</div>
<div class="line">                                $DB-&gt;workshop_subjects[]= array(<span class="stringliteral">&#39;wid&#39;</span>=&gt;$wid, <span class="stringliteral">&#39;subject&#39;</span>=&gt;$d);</div>
<div class="line">                $PAGE-&gt;addMessage(_(<span class="stringliteral">&#39;Saved.&#39;</span>), <span class="stringliteral">&#39;success&#39;</span>);</div>
<div class="line">                <a class="code" href="log_8php.html#a5eaecfade7f5e117c98d7635b2aba95f">logUser</a>(<span class="stringliteral">&#39;workshop edit&#39;</span>, $wid);</div>
<div class="line">        }</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Sun Sep 8 2013 17:44:57 for wwwApp by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>
